using Microsoft.AspNetCore.Mvc;
using Read.Models;
using Read.Services;
using Read.Utility;

namespace Read.Web.Admin
{
    /// <summary>
    /// LogController
    /// </summary>
    public class LogController : AdminBaseController
    {
        /// <summary>
        /// 登录日志
        /// </summary>
        /// <returns></returns>
        public IActionResult LoginLog(QueryParamsLoginLog query)
        {
            if (HttpContext.Request.IsAjaxRequest())
            {
                var srevice = new LogService();
                var res = srevice.getLoginLogList(query);
                return Json(res);
            }
            else
            {
                ViewBag.Title = "登录日志列表";
                return View();
            }
        }

        /// <summary>
        /// 操作日志
        /// </summary>
        /// <returns></returns>
        public IActionResult OperationLog(QueryParamsOperationLog query)
        {
            if (HttpContext.Request.IsAjaxRequest())
            {
                var srevice = new LogService();
                var res = srevice.getOperationLogList(query);
                return Json(res);
            }
            else
            {
                ViewBag.Title = "操作日志列表";
                return View();
            }
        }
    }
}